package wordroid.activitys;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.app.Dialog;
import android.content.Intent;
import android.os.Bundle;
import android.text.Editable;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import java.util.ArrayList;
import wordroid.database.DataAccess;
import wordroid.model.Word;

public class EditWord extends Activity
  implements View.OnClickListener
{
  private String action;
  private Button cancel;
  private Button confirm;
  private EditText meanning;
  private EditText spelling;
  private Word word;

  private void initWidgets()
  {
    this.spelling = ((EditText)findViewById(2131165185));
    this.cancel = ((Button)findViewById(2131165188));
    this.confirm = ((Button)findViewById(2131165187));
    this.meanning = ((EditText)findViewById(2131165186));
    this.cancel.setOnClickListener(this);
    this.confirm.setOnClickListener(this);
    if (!(this.action.equals("edit")))
      return;
    Bundle localBundle = getIntent().getExtras();
    Word localWord = (Word)new DataAccess(this).QueryAttention("ID ='" + localBundle.getString("id") + "'", null).get(0);
    this.spelling.setText(localWord.getSpelling());
    this.meanning.setText(localWord.getMeanning());
  }

  public void onClick(View paramView)
  {
    if (paramView == this.cancel)
      finish();
    if (paramView == this.confirm)
    {
      if ((!(this.meanning.getText().toString().equals(""))) && (!(this.spelling.getText().toString().equals(""))))
      //  break label71;
      Toast.makeText(this, "信息不能为空", 0).show();
    }
    while (true)
    {
      return;
    /*  if (this.action.equals("add"))
      {
      //  label71: 
    	  int i = 1;
        DataAccess localDataAccess2 = new DataAccess(this);
        ArrayList localArrayList = localDataAccess2.QueryAttention(null, null);
        for (int j = 0; ; ++j)
        {
          if (j >= localArrayList.size())
          {
            if (i == 0)
              new AlertDialog.Builder(this).setIcon(2130837509).setTitle("该单词已存在").setMessage("生词本中有这个单词，要覆盖掉它吗？").setPositiveButton("确定", new 1(this, localDataAccess2)null).setNegativeButton("取消", new 2(this)null).create().show();
            if (i != 0);
            Word localWord2 = new Word();
            localWord2.setMeanning(this.meanning.getText().toString());
            localWord2.setSpelling(this.spelling.getText().toString());
            localWord2.setPhonetic_alphabet(" ");
            localDataAccess2.InsertIntoAttention(localWord2);
            finish();
          }
          if (!(this.spelling.getText().toString().equals(((Word)localArrayList.get(j)).getSpelling())))
            continue;
          i = 0;
         // Log.i("thesame", j);
          this.word = ((Word)localArrayList.get(j));
        }
      }*/
     /* if (!(this.action.equals("edit")))
        continue;*/
     /* new Bundle();
      Bundle localBundle = getIntent().getExtras();
      DataAccess localDataAccess1 = new DataAccess(this);
      Word localWord1 = (Word)localDataAccess1.QueryAttention("ID = '" + localBundle.getString("id") + "'", null).get(0);
      localWord1.setMeanning(this.meanning.getText().toString());
      localWord1.setSpelling(this.spelling.getText().toString());
      localDataAccess1.UpdateAttention(localWord1);
      finish();*/
    }
  }

  protected void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    setTitle("编辑生词本");
    setContentView(2130903041);
    this.action = getIntent().getExtras().getString("action");
    initWidgets();
  }
}

/* Location:           E:\Desktop\Android\英语词汇记忆\classes_dex2jar.jar
 * Qualified Name:     wordroid.activitys.EditWord
 * JD-Core Version:    0.5.3
 */